const express = require('express')

const app = express()

app.use(require('cors')())

// require('./routes/index')(app)

const _product = [{
        name: '小熊即热电热水器',
        price: 239,
        img: 'https://img14.360buyimg.com/n7/jfs/t1/159059/26/1725/121283/5ff4211cE4db5c845/5088b414f61d2a13.jpg',
        num: 4400,
        shop: '小熊京东自营旗舰店',
        id: 1
    },
    {
        name: '米家踢脚线电暖器E',
        price: 499,
        img: 'https://cdn.cnbj0.fds.api.mi-img.com/b2c-shopapi-pms/pms_1600695132.80131541.jpg',
        num: 8952,
        shop: '小米京东自营旗舰店',
        id: 2

    },
    {
        name: '米家踢脚线电暖器',
        price: 599,
        img: 'https://cdn.cnbj0.fds.api.mi-img.com/b2c-shopapi-pms/pms_1572315753.91481212.jpg',
        num: 6432,
        shop: '小米京东自营旗舰店',
        id: 3
    },
    {
        name: '米家踢脚线电暖器1S',
        price: 649,
        img: 'https://cdn.cnbj0.fds.api.mi-img.com/b2c-shopapi-pms/pms_1599536467.27169261.jpg',
        num: 6500,
        shop: '小米京东自营旗舰店',
        id: 4
    },
    {
        name: 'iPhone12',
        price: 5699,
        img: 'https://img10.360buyimg.com/n7/jfs/t1/132022/23/12216/60913/5f86195bEacd08599/c5dc348d3f943324.jpg',
        num: 11000,
        shop: 'Apple苹果京东自营旗舰店',
        id: 5
    }
]

app.use(express.json())

app.get('/product/data', (req, res) => {
    res.status(200).json(_product)
})

app.listen(3000, () => {
    console.log('App running on port 3000!')
})